home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample PMSAM / PMSAM Framework / Common / CQueueEnumerator.cp < prev    next >
Encoding:
Text File  |  1995-07-28  |  1.6 KB  |  76 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CQueueEnumerator.cp
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Tim Harnett
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>     9/22/94    TMH        made this from stuff in TMSAMSlot::GetIncomingLetter
  13.          <1>     9/22/94    TMH        made this from stuff in TMSAMSlot::GetIncomingLetter
  14.                  9/22/94    TMH        xxx put comment here xxx
  15.  
  16.     To Do:
  17. */
  18.  
  19. #ifndef __CQueueEnumerator__
  20. #include "CQueueEnumerator.h"
  21. #endif
  22.  
  23. #ifndef __THREADS__
  24. #include "Threads.h"
  25. #endif
  26.  
  27.  
  28. //---------------------------------
  29. //    C O u t Q E n u m e r a t o r 
  30. //---------------------------------
  31.  
  32. //-----------------------------------------------------------------------------------
  33. COutQEnumerator::COutQEnumerator(MSAMQueueRef qRef)
  34. {
  35.     fPB.ioCompletion = 0;
  36.     fPB.queueRef  = qRef;
  37.     fPB.buffer.bufferSize = sizeof(EnumOutQReply);
  38.     fPB.buffer.buffer = (Ptr)&fEnumBlock;
  39. }
  40.  
  41.  
  42. //-----------------------------------------------------------------------------------
  43. MSAMEnumerateOutQReply* COutQEnumerator::FirstLetter()
  44. {
  45.     fPB.startSeqNum = 1;
  46.     this->Enumerate();
  47.     return &fEnumBlock.outQEnumReply;
  48.  
  49. }
  50.  
  51.  
  52. //-----------------------------------------------------------------------------------
  53. MSAMEnumerateOutQReply* COutQEnumerator::NextLetter()
  54. {
  55.     fPB.startSeqNum = fPB.nextSeqNum;
  56.     if( this->More() ) {
  57.         this->Enumerate();
  58.         return &fEnumBlock.outQEnumReply;
  59.     } else
  60.         return 0;
  61.         
  62.         
  63.     
  64. }
  65.  
  66. //-----------------------------------------------------------------------------------
  67. void COutQEnumerator::Enumerate()
  68. {
  69.     MSAMEnumerate((MSAMParam *)&fPB,true);
  70.     do {
  71.         YieldToAnyThread();
  72.     } while( fPB.ioResult > 0 );
  73.     
  74. }
  75.  
  76.